//package nat;
//
//import java.io.*;
//import java.net.ServerSocket;
//import java.net.Socket;
//
///**
// * @Author: Miyako
// * @Date: 2024-07-18-17:47
// * @Description: 双人聊天室服务端
// */
//public class ChartServer01 {
//    public static int s =0;
//    private ServerSocket serverSocket;
//    ChartServer01(){//生成两个对象
//        try {
//            System.out.println("server start...");
//            serverSocket = new ServerSocket(8888);
//            System.out.println("server start  ok!");
//        } catch (Exception e) {
//            e.printStackTrace();
//            System.out.println("server start error!");
//            System.exit(-1);
//        }
//    }
//    public void start(){
//        try {
//            System.out.println("Wait Client Link...");
//            Socket socket = serverSocket.accept();//A客户链接
//            System.out.println("Client A Link ok!");//A链接成功
//            Socket socket2 = serverSocket.accept();//B客户链接
//            System.out.println("Client B Link ok!");//B链接成功
//            BufferedReader bw = new BufferedReader(new InputStreamReader(socket.getInputStream()));
//            BufferedReader bw2 = new BufferedReader(new InputStreamReader(socket2.getInputStream()));
//
//            PrintWriter pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()),true);
//            PrintWriter pw2 = new PrintWriter(new OutputStreamWriter(socket2.getOutputStream()),true);
//
//            String str;
//            String str2;
////            while ((str=bw.readLine()) != null) {
////                System.out.println("接收信息："+str);
////            }
//            while ((str = bw.readLine()) != null) {//接收一号用户的信息
//                System.out.println(str);
//                pw2.println(str);//A的内容发送给B用户
//
//                if ((str2 = bw2.readLine()) != null)
//                    System.out.println(str2);
//                pw.println(str2);//B的内容发送给A用户
//                s++;
//
//            }
//            }
//            catch(IOException e){
//                    System.out.println("Link error!");
//                    System.exit(-1);
//                }
//            }
//    public static void main(String[] args) {
//        new ChartServer01().start();
//    }
//}
